<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace='SysSequence' xmlns='http://ibatis.apache.org/mapping' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
  <alias>
    <typeAlias alias='SysSequence' assembly='Janus.Mes.POCO.dll' type='Janus.Mes.POCO.SysSequence' />
  </alias>
  <resultMaps>
    <resultMap id='SysSequenceResult' class='SysSequence'>
	<result property='SequenceName' column='SequenceName' /> 
	<result property='ChineseName' column='ChineseName' /> 
	<result property='Prefix' column='Prefix' /> 
	<result property='DateLength' column='DateLength' /> 
	<result property='Width' column='Width' /> 
	<result property='CurrentValue' column='CurrentValue' /> 
	<result property='CreateDate' column='CreateDate' /> 
		</resultMap>
  </resultMaps>  
  <statements>
  <sql id="UpdaterConditions">  
  <dynamic prepend="SET">
      	<isPropertyAvailable prepend="" property="ChineseName">
        <isNotEmpty prepend="," property="ChineseName">
		          [ChineseName]=#ChineseName#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="Prefix">
        <isNotEmpty prepend="," property="Prefix">
		          [Prefix]=#Prefix#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="DateLength">
        <isNotEmpty prepend="," property="DateLength">
		          [DateLength]=#DateLength#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="Width">
        <isNotEmpty prepend="," property="Width">
		          [Width]=#Width#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="CurrentValue">
        <isNotEmpty prepend="," property="CurrentValue">
		          [CurrentValue]=#CurrentValue#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="CreateDate">
        <isNotEmpty prepend="" property="CreateDate">
				  <isNotEqual prepend="," property="CreateDate" compareValue="(getdate())">
		          [CreateDate]=#CreateDate#
		  		  </isNotEqual>
		        </isNotEmpty>
      </isPropertyAvailable>	
	  	 </dynamic>
    </sql>
	<sql id="WhereConditions">
	 <dynamic prepend="WHERE">
	 	 <isPropertyAvailable prepend="" property="SequenceName">
        <isNotEmpty prepend="AND" property="SequenceName">
		          [SequenceName]=#SequenceName#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="ChineseName">
        <isNotEmpty prepend="AND" property="ChineseName">
		          [ChineseName]=#ChineseName#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="Prefix">
        <isNotEmpty prepend="AND" property="Prefix">
		          [Prefix]=#Prefix#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="DateLength">
        <isNotEmpty prepend="AND" property="DateLength">
		          [DateLength]=#DateLength#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="Width">
        <isNotEmpty prepend="AND" property="Width">
		          [Width]=#Width#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="CurrentValue">
        <isNotEmpty prepend="AND" property="CurrentValue">
		          [CurrentValue]=#CurrentValue#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="CreateDate">
        <isNotEmpty prepend="" property="CreateDate">
				  <isNotEqual prepend="AND" property="CreateDate" compareValue="(getdate())">
		          [CreateDate]=#CreateDate#
		  		  </isNotEqual>
		        </isNotEmpty>
      </isPropertyAvailable>
	  </dynamic> 
    </sql>
	<sql id="InsertPublic">
      INSERT INTO SysSequence(
	     <dynamic prepend=" ">
       	   <isPropertyAvailable prepend="" property="SequenceName">
        <isNotEmpty prepend="," property="SequenceName">
          [SequenceName]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="ChineseName">
        <isNotEmpty prepend="," property="ChineseName">
          [ChineseName]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="Prefix">
        <isNotEmpty prepend="," property="Prefix">
          [Prefix]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="DateLength">
        <isNotEmpty prepend="," property="DateLength">
          [DateLength]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="Width">
        <isNotEmpty prepend="," property="Width">
          [Width]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="CurrentValue">
        <isNotEmpty prepend="," property="CurrentValue">
          [CurrentValue]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="CreateDate">
        <isNotEmpty prepend="," property="CreateDate">
          [CreateDate]
        </isNotEmpty>
      </isPropertyAvailable>
	  </dynamic>
      )
      VALUES
      (
	   <dynamic prepend=" ">
      	<isPropertyAvailable prepend="" property="SequenceName">
        <isNotEmpty prepend="," property="SequenceName">		
         #SequenceName#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="ChineseName">
        <isNotEmpty prepend="," property="ChineseName">		
         #ChineseName#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="Prefix">
        <isNotEmpty prepend="," property="Prefix">		
         #Prefix#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="DateLength">
        <isNotEmpty prepend="," property="DateLength">		
         #DateLength#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="Width">
        <isNotEmpty prepend="," property="Width">		
         #Width#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="CurrentValue">
        <isNotEmpty prepend="," property="CurrentValue">		
         #CurrentValue#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="CreateDate">
        <isNotEmpty prepend="," property="CreateDate">		
         #CreateDate#		
        </isNotEmpty>
      </isPropertyAvailable>
	  </dynamic>
      )
    </sql>
	<!-- Insert statement:新增Mapper-->
    <insert id='Insert' parameterClass='SysSequence'>
      <include refid="InsertPublic"/>
    </insert>
    <!--Update statement:修改Mapper-->
    <update id='Update' parameterClass='SysSequence'>
      UPDATE [SysSequence] 
      <include refid="UpdaterConditions"/>
      WHERE 1=1
	  	  AND SequenceName=#SequenceName#
	      </update>
    <update id='UpdateSetion' parameterClass='hashtable'>
      UPDATE [SysSequence] 
      <include refid="UpdaterConditions"/>
      WHERE $conditions$
    </update>
	<update id='Save' parameterClass='SysSequence'>
      IF NOT EXISTS(SELECT 1 FROM [SysSequence] WHERE 1=1  AND [SequenceName]=#SequenceName# )
      BEGIN
      <include refid="InsertPublic"/>
      END
      ELSE
      BEGIN
      UPDATE SysSequence 
      <include refid="UpdaterConditions"/>
      WHERE  1=1
	  	  AND [SequenceName]=#SequenceName#
	        END
    </update>
	<delete id='Delete' parameterClass='hashtable'>
      DELETE FROM [SysSequence] WHERE	  
        <![CDATA[  
	 [SequenceName]=#pk0# 
        ]]>
    </delete>
    <delete id='DeleteWhere' parameterClass='string'>
      DELETE FROM [SysSequence] WHERE $value$
    </delete>

    <!-- select by key statement:-->
    <select id='FindOne' parameterClass='hashtable' resultClass='SysSequence'>
      SELECT * FROM SysSequence WHERE      
        <![CDATA[
		[SequenceName]=#pk0# 
        ]]>
    </select>
    <select id='FindAllCondition' parameterClass='string' resultClass='SysSequence'>
      SELECT * FROM [SysSequence] WHERE $value$
    </select>
    <select id='FindScalar' parameterClass='hashtable' resultClass='SysSequence'>
      SELECT * FROM [SysSequence] WHERE $conditions$
    </select>
    
    <select id='FindAllCount' parameterClass='string' resultClass='int'>
      SELECT COUNT(1) FROM [SysSequence] WHERE $value$
    </select>
    <select id='FindByPage' parameterClass='string' resultClass='SysSequence'>
      SELECT * FROM [SysSequence] WHERE $value$
    </select>
  </statements>
</sqlMap>
